<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>expm1</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_000_004_083">&nbsp;</a>NAME</h4><blockquote>
expm1 - compute exponential functions
</blockquote><h4><a name = "tag_000_004_084">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="math.h.html">math.h</a>&gt;

double expm1 (double <i>x</i>);
</code>
</pre>
</blockquote><h4><a name = "tag_000_004_085">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>expm1()</i>
function computes <i>e</i><sup><small><i>x</i></small></sup>-1.0.
</blockquote><h4><a name = "tag_000_004_086">&nbsp;</a>RETURN VALUE</h4><blockquote>
<p>
If <i>x</i> is NaN, then the function returns NaN and <i>errno</i>
may be set to EDOM.
<p>
If <i>x</i> is positive infinity,
<i>expm1()</i>
returns positive infinity.
<p>
If <i>x</i> is negative infinity,
<i>expm1()</i>
returns -1.0.
<p>
If the value overflows,
<i>expm1()</i>
returns HUGE_VAL and may set <i>errno</i> to ERANGE.
</blockquote><h4><a name = "tag_000_004_087">&nbsp;</a>ERRORS</h4><blockquote>
The
<i>expm1()</i>
function may fail if:
<dl compact>

<dt>[EDOM]<dd>
The value of <i>x</i> is NaN.

<dt>[ERANGE]<dd>
The result overflows.

</dl>
</blockquote><h4><a name = "tag_000_004_088">&nbsp;</a>EXAMPLES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_004_089">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
The value of
<i>expm1</i>(<i>x</i>)
may be more accurate than
<i>exp</i>(<i>x</i>)-1.0
for small values of
<i>x</i>.
<p>
The
<i>expm1()</i>
and
<i><a href="log1p.html">log1p()</a></i>
functions are useful for financial calculations of
((1+<i>x</i>)<sup><small><i>n</i></small></sup>-1)/<i>x</i>, namely:
<pre>
<dl compact><dt> <dd>
expm1(<i>n</i> * log1p(<i>x</i>))/<i>x</i>
</dl>
</pre>
when <i>x</i> is very small (for example, when calculating small
daily interest rates).  These functions also simplify writing
accurate inverse hyperbolic functions.
</blockquote><h4><a name = "tag_000_004_090">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_004_091">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="exp.html">exp()</a></i>,
<i><a href="ilogb.html">ilogb()</a></i>,
<i><a href="log1p.html">log1p()</a></i>,
<i><a href="math.h.html">&lt;math.h&gt;</a></i>.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
